import request from '@/api/request.js'

//查询员工
const searchEmpByEnameApi = (ename)=>{
  return request.get('/searchEmpByEname',{params:{'ename': ename}})
}
//删除员工
const deleteEmpApi = (empno)=>{
  return request.get('/deleteEmp',{params:{'empno': empno}})
}
//添加员工
const addEmpApi = (emp) => {
  let params= new URLSearchParams();
  //params.append('empno', emp.empno);
  params.append('ename', emp.ename);
  params.append('job', emp.job);
  params.append('deptno', emp.deptno);
  params.append('sal', emp.sal);
  return request.post('/insertEmp',params)
}
//修改员工
const updateEmpApi = (emp) => {
  let params = new URLSearchParams();
  params.append('empno', emp.empno);
  params.append('ename', emp.ename);
  params.append('job', emp.job);
  params.append('deptno', emp.deptno);
  params.append('sal', emp.sal);
  return request.post('/editEmp',params)
}

export {
  searchEmpByEnameApi,
  deleteEmpApi,
  addEmpApi,
  updateEmpApi
}